package com.jd.ssdb4j.client;

import com.jd.ssdb4j.base.Response;

import java.util.List;

public interface SSDB {

    // K-V
    public Response set(Object key, Object val);
    public Response setx(Object key, Object val, int ttl);
    public Response setnx(Object key, Object val);
    public Response get(Object key);
    public Response getset(Object key, Object val);
	public Response del(Object key);
    public Response incr(Object key, int val);
    public Response exists(Object key);
    public Response keys(Object start, Object end, int limit);
    public Response scan(Object start, Object end, int limit);
    public Response rscan(Object start, Object end, int limit);
    public Response multi_set(Object... pairs);
    public Response multi_get(Object... keys);
    public Response multi_del(Object... keys);

    // K-Map
	public Response hset(Object key, Object hkey, Object hval);
    public Response hget(Object key, Object hkey);
    public Response hdel(Object key, Object hkey);
    public Response hincr(Object key, Object hkey, int val);
    public Response hexists(Object key, Object hkey);
    public Response hsize(Object key);
    public Response hlist(Object key, Object hkey, int limit);
    public Response hkeys(Object key, Object start, Object end, int limit);
    public Response hscan(Object key, Object start, Object end, int limit);
    public Response hrscan(Object key, Object start, Object end, int limit);
    public Response hclear(Object key);
    public Response multi_hset(Object key, Object... pairs);
    public Response multi_hget(Object key, Object... hkeys);
    public Response multi_hdel(Object key, Object... hkeys);

    // K-Set
	public Response zset(Object key, Object zkey, double score);
    public Response zget(Object key, Object zkey);
    public Response zdel(Object key, Object zkey);
    public Response zincr(Object key, Object zkey, int val);
    public Response zsize(Object key);
    public Response zexists(Object key, Object zkey);
    public Response zlist(Object key, Object zkey, int limit);
    public Response zkeys(Object key, Object start, Object end, int limit);
    public Response zscan(Object key, Object start, Object end, int limit);
    public Response zrscan(Object key, Object start, Object end, int limit);
    public Response zrange(Object key, int offset, int limit);
    public Response zrrange(Object key, int offset, int limit);
	public Response zrank(Object key, Object zkey);
	public Response zrrank(Object key, Object zkey);
	public Response zclear(Object key);
    public Response zcount(Object key, int start, int end);
    public Response zsum(Object key, int start, int end);
    public Response zavg(Object key, int start, int end);
//  public Response zRemRangeByScore();
//  public Response zRemRangeByRank();
    public Response multi_zset(Object key, Object... pairs);
    public Response multi_zget(Object key, Object... zkeys);
    public Response multi_zdel(Object key, Object... zkeys);

    // K-Queue
	public Response qsize(Object key);
    public Response qclear(Object key);
    public Response qfront(Object key);
    public Response qback(Object key);
    public Response qget(Object key, int index);
    public Response qslice(Object key, int start, int end);
    public Response qpush(Object key, Object value);
    public Response qpush_front(Object key, Object value);
    public Response qpush_back(Object key, Object value);
    public Response qpop(Object key);
    public Response qpop_front(Object key);
    public Response qpop_back(Object key);

    public SSDB batch();
	public List<Response> exec();

    public Response flushdb(Object key);
    public Response info();
    public Response ping();
}
